/**
 * Demonstrates a range of Button options the framework offers out of the box
 */
Ext.define('cloud.view.area.AreaAdd', {
    extend: 'Ext.form.Panel',
    xtype: 'areaadd',

    requires: ['Ext.form.Panel', 'Ext.form.FieldSet', 'Ext.field.Select', 'Ext.field.Hidden'],
    config: {
        //style:'font-size:14px',
        title: '添加地区',
        items: [
            {
                xtype: 'toolbar',
                docked: 'bottom',
                layout: {
                    type: 'hbox',
                    pack: 'end'
                },
                items: [
                    {
                        id: 'area_submit',
                        iconMask: true,
                        scope: this,
                        cls: 'x-button2',
                        text: '提交',
                        style: 'float:right'
                    }
                ]
            },
            {
                xtype: 'fieldset',
                title: '新增地区',
                defaults: {
                    labelwidth: '20%',
                    xtype: 'textfield',
                    required: true,
                    clearIcon: true
                },
                items: [
                    {
                        xtype: 'selectfield',
                        store: 'AreaStore',
                        id: 'province',
                        name: 'province',
                        label: '选择省份',
                        listeners: {
                            change: function () {

                                var upid = Ext.getCmp('province').getValue();
                                var cityStore = Ext.getStore('CityStore');
                                cityStore.load({params: {upid: upid}});
                                this;
                            },
                            initialize: function () {
                                var upid = Ext.getCmp('province').getValue();
                                var cityStore = Ext.getStore('CityStore');
                                cityStore.load({params: {upid: upid}});
                            }
                        }

                    },
                    {
                        xtype: 'selectfield',
                        store: 'CityStore',
                        id: 'city',
                        name: 'city',
                        label: '选择城市'
                    },
                    {
                        xtype: 'selectfield',
                        store: 'TimeStore',
                        id: 'starttime',
                        name: 'starttime',
                        label: '选择开始时间'
                    },
                    {
                        xtype: 'selectfield',
                        store: 'TimeStore',
                        id: 'endtime',
                        name: 'endtime',
                        label: '选择结束时间'
                    },
                    {
                        xtype: 'togglefield',
                        name: 'status',
                        id: 'status',
                        label: '是否启用',
                        labelWidth: '30%'
                    }
                ]
            }
        ]
    }
});